package com.ht.web360.base.dto.PojInfo.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@Schema(description = "项目基础数据，用于首页显示")
public class PojBasicDto {
    @Schema(description = "id")
    String id;

    @Schema(description = "名称")
    String name;

    @Schema(description = "封面链接")
    String coverLink;

    @Schema(description = "创建者名称")
    String creatorName;

    @Schema(description = "创建者头像")
    String creatorAvatar;

    @Schema(description = "更新时间")
    LocalDateTime updateTime;

    public static PojBasicDto getInstance(PojInfoDto pojInfoDto, String creatorName, String creatorAvatar) {
        PojBasicDto dto = new PojBasicDto();
        dto.setId(pojInfoDto.getId());
        dto.setName(pojInfoDto.getName());
        dto.setCoverLink(pojInfoDto.getCoverLink());
        dto.setCreatorName(creatorName);
        dto.setCreatorAvatar(creatorAvatar);
        dto.setUpdateTime(pojInfoDto.getUpdateTime());
        return dto;
    }
}
